﻿using System;

namespace ForgeCraft
{
    public class CmdSpawn : Command
    {
        public override string name { get { return "spawn"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "op"; } }
        public override bool consoleUsable { get { return false; } }
        public override Permission defaultRank { get { return Permission.Guest; } }
        public CmdSpawn() { }

        public override void Use(Player p, string message)
        {
            Creature newMob = new Creature();

            byte type = 0;

            byte.TryParse(message, out type);


            
            if (type > 0)
            {
                newMob.mobType = type;
                new MobEntity((int)p.pos.x, (int)p.pos.y, (int)p.pos.z, newMob, p.currentWorld);
            }
        }

        public override void Help(Player p)
        {
            p.Message(Color.Aqua + "/spawn " + Color.Help + "- Spawns a critter.");
        }
    }
}